package com.bamboo.core.domain.response;


import java.util.List;

/**
* @description 返回分页查询的结果集
* @date 2025/3/7 8:47
* @author chenzh
*/
public class Table<T> {
    /**
     * 结果集总量
     */
    private long total;
    /**
     * 每页的数量
     */
    private long size;
    private long page;
    /**
     * 数据项
     */
    private List<T> list;

    public Table(long total, long size, List<T> list) {
        this.total = total;
        this.size = size;
        this.list = list;
    }

    public long getTotal() {
        return total;
    }

    public void setTotal(long total) {
        this.total = total;
    }

    public long getPage() {
        this.page = Math.round((double) this.total / this.size);
        return page;
    }

    public void setPage(long page) {
        this.page = page;
    }

    public long getSize() {
        return size;
    }

    public void setSize(long size) {
        this.size = size;
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }
}
